window.onload = function() {
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 1,
        spaceBetween: 30,
        loop: true,
        pagination: {
            el: '.swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },
    });
    // 鼠标经过遮罩层会移上来
    let uniteImg = document.querySelectorAll('.unite-img');
    let imageLable = document.querySelectorAll('.image-lable');
    for (let i = 0; i < uniteImg.length; i++) {
        uniteImg[i].onmousemove = function() {
            imageLable[i].style.transform = 'translateY(-295.5px)';
        }
        uniteImg[i].onmouseleave = function() {
            imageLable[i].style.transform = 'translateY(0)';
        }
    }
    // 每隔1S切换一次图片
    let foodlistUl = document.querySelectorAll('.foodimgdiv');
    rotate();

    function rotate() {
        let x = 0;
        let t = setInterval(function() {
            x++;
            for (let i = 0; i < foodlistUl.length; i++) {
                console.log(x);
                let rotatedeg = x * 180 + 'deg';
                foodlistUl[i].style.transform = `rotateY(${rotatedeg})`;
                foodlistUl[i].style.transition = 'all 2s';
            }
        }, 5000)
    }

}